package com.jixiantubu.adapter;

import image.SmartImageView;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import com.example.jixiantubu.R;
import com.jixiantubu.bean.Sciencebean;
import com.jixiantubu.util.MyApplication;



import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class JinNang_KePu_Adapter extends BaseAdapter {
	private static final int ALBUM = 0;
	private static final int GOODS = 1;
	LayoutInflater mInflater;
	Context context;
	List<Sciencebean> list=new ArrayList<Sciencebean>();
	ViewHolder holder;

	public JinNang_KePu_Adapter(Context context, List<Sciencebean> list) {
		super();
		this.context = context;
		this.list = list;
		mInflater = LayoutInflater.from(context);
	}

	public List<Sciencebean> getList() {
		return list;
	}

	public void setList(List<Sciencebean> list) {
		this.list = list;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return list.size();
	}

	@Override
	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		return list.get(arg0);
	}

	@Override
	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return arg0;
	}

	@Override
	public View getView(int arg0, View arg1, ViewGroup arg2) {
		if (arg1 == null) {
			holder = new ViewHolder();
			arg1 = mInflater.inflate(R.layout.jinnang_keputuijian_item, null);
			holder.imageView = (SmartImageView) arg1
					.findViewById(R.id.jinnang_kepu_iv);
			arg1.setTag(holder);
		} else {
			holder = (ViewHolder) arg1.getTag();
		}
		String url = "http://" + MyApplication.getIP()
				+ ":8080/Jinnang/img/"
				+ list.get(arg0).getS_photo_path();
		holder.imageView.setImageUrl(url, R.drawable.error, R.drawable.loding);
		Log.e("hujiaolong", url);
		return arg1;
	}

	public class ViewHolder {
		SmartImageView imageView;

	}
}
